<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>H5页面</title>
	</head>

	<body>
		<button style="width:200px;height:100px;">点击跳转到首页</button>
		<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
		<script>
			function queryParam(name) {
				return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[
					1].replace(/\+/g, '%20')) || null
			}
			
			let id = queryParam('article_id'),sign = queryParam('sign_key')
			
			var smallPro = false;
			//判断当前页面是否在小程序环境中
			wx.miniProgram.getEnv(function(res) {
				console.log(res.miniprogram) // true
				if (res.miniprogram) {
					smallPro = true;
				} else {
					smallPro = false;
				}

			});
			document.getElementsByTagName('button')[0].onclick = function() {
				if(smallPro){
					wx.miniProgram.navigateTo({
						url: '../../pages/login/common?jiangyuang=贝思客第一打野'
					});
				}else{
					window.parent.location.href='../../pages/login/common?jiangyuang=贝思客第一打野'
				}
				
			}
		</script>
	</body>

</html>
